package com.hoyue.service;

import com.hoyue.bean.MessageBoard;
import com.hoyue.dao.MessageBoardDao;
import com.hoyue.dao.impl.MessageBoardDaoImpl;
import com.hoyue.utils.Page;

import java.sql.SQLException;
import java.util.List;

/**
 * @author Hoyue_network1
 * @version 1.0
 * Creat by 2018/8/22 23:47
 */
public class MessageBoardService {

    MessageBoardDao message_boardDao = new MessageBoardDaoImpl();
    //查
    public List<MessageBoard> getAllmessageBoard() {
        try {
            return message_boardDao.getAllMessageBoard();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
    //增
    public void addMessageBoard(MessageBoard messageBoard) {
        try {
            message_boardDao.addMessageBoard(messageBoard);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
    //删
    public void deleteMessageBoard(int id) {
        try {
            message_boardDao.deleteMessageBoard(id);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
    //改
    public void updateMessageBoard(MessageBoard messageBoard) {
        try {
            message_boardDao.updateMessageBoard(messageBoard);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    //批量删除
    public void deleteMessageBoards(String ids) {
        try {
            message_boardDao.deleteMessageBoards(ids);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    public Page<MessageBoard> getPage(int page) {
        try {
            return message_boardDao.getPage(page,"message_board");
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
